Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing collection to be created passing null #507

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

dbpolito
Copy link
Contributor

Currently if you call Data::collection(null), it breaks... it's useful for when you are doing something like Data::collection($var?->collection) and avoiding doing and if or Data::collection($var?->collection ?? [])...

Also keeps consistent with Laravel's Collection, which you can create passing null and will just create an empty collection.

@rubenvanassche
Copy link
Member

Thanks!

@rubenvanassche rubenvanassche merged commit 6d1acd2 into spatie:main Aug 4, 2023
11 checks passed
@dbpolito dbpolito deleted the collection_passing_null branch August 4, 2023 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants